package com.ihr360.payroll.model.dto.salary.task.period;

import com.ihr360.hibernate.type.encrypt.JsonEncryptType;
import com.ihr360.hibernate.type.json.JsonStringType;
import com.ihr360.payroll.model.dto.salary.task.period.embeddable.CalcMiddleRow;
import com.ihr360.payroll.model.dto.salary.task.period.embeddable.StaffSalaryTermId;
import lombok.Data;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;

@TypeDefs({
        @TypeDef(name = "json", typeClass = JsonStringType.class),
        @TypeDef(name = "json-encrypt", typeClass = JsonEncryptType.class)
})
@Data
@Entity
public class SalaryCalcMiddleData {
    @EmbeddedId
    StaffSalaryTermId id;

    @Column(length = 40, nullable = false, name = "companyId")
    private String companyId;

    @Column(length = 32, nullable = true, name = "staffName")
    private String staffName;

    @Column(length = 18, nullable = true, name = "mobileNo")
    private String mobileNo;

    @Column(length = 40, nullable = true, name = "dataName")
    private String dataName;

    @Column(columnDefinition = "text")
    @Type(type = "json")
    private CalcMiddleRow data;

}